﻿<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Financial Tracking</title>
<script src="${pageContext.request.contextPath}/js/jquery.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/jquery-ui.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/global.js" type="text/javascript"></script>

<link rel="stylesheet" href="${pageContext.request.contextPath}/css/jquery-ui.css" type="text/css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/styles.css" type="text/css" />

<script>
	$(function() {
		$("head").append('<link rel="icon" type="image/icon" href="${pageContext.request.contextPath}/images/mini-icon.ico">');
		
		$("#txtFromDateAdmidTime,#txtToDateAdmidTime").datepicker({
			buttonImage : "${pageContext.request.contextPath}/images/calendar.gif"
		});
		
		$("#detailData").css("display","none");
		
		var selectZone = "กรุณาเลือกเขต";
		var selectProvince = "กรุณาเลือกจังหวัด";
		var selectHospital = "กรุณาเลือกหน่วยบริการ";
		
		$("#txtDataListProvince").html("<option value=''>"+ selectProvince+ "</option>");
		
		$("#txtDataListHospital").html("<option value='"+selectHospital+"'>"+ selectHospital+ "</option>");
		$("#txtDataListHospital").combobox();
		
		$(".custom-combobox-input").focusin(function(){
			$(this).val("");
		});
		
		$(".custom-combobox-input").focusout(function(){
			var text = $( "#txtDataListHospital option:selected" ).text();
			$(this).val(text);
		});
		
		$.ajax({
			url : '${pageContext.request.contextPath}/master/getZone',
			type : "POST",
			success : function(data) {
				var datas = data.datas;
				var option = "<option value='' selected>"+ selectZone + "</option>";
				if(datas.length >0 ){
					$.each(data.datas,
							function(key, value) {
								var zoneId = value.zoneId;
								var zoneName = value.zoneName;
								option += "<option value='"+zoneId+"'>"
										+ zoneName
										+ "</option>";
					});
				}
				$("#txtDataListZone").html(option);
			}
		});
		
		$("#txtDataListZone").change(function(){
			var zoneId = $("#txtDataListZone option:selected").val();
			if(zoneId !== ""){
				$.ajax({
					url : '${pageContext.request.contextPath}/master/getProvince',
					data:{zoneId : zoneId},
					type : "POST",
					success : function(data) {
						var datas = data.datas;
						var option = "<option value='' selected>"+ selectProvince + "</option>";
						$.each(
								data.datas,
								function(key, value) {
									var provinceId = value.provinceCode;
									var provinceName = value.provinceName;
									option += "<option value='"+provinceId+"'>"
											+ provinceName
											+ "</option>";
						});
						$("#txtDataListProvince").html(option);
					}
				});
			}else{
				$("#txtDataListProvince").html("<option value='' selected>"+ selectZone + "</option>");
				$("#txtDataListHospital").html("<option value='"+selectHospital+"'>"+ selectHospital+ "</option>");
				$("#txtDataListHospital").combobox();
				$(".custom-combobox-input").val(selectHospital);
			}
		});
		
		
		$("#txtDataListProvince").change(function(){
			var zoneId = $("#txtDataListZone option:selected").val();
			var provinceId = $("#txtDataListProvince option:selected").val();
			if(provinceId !== "" && zoneId !== ""){
				$.getHospital(zoneId,provinceId,true);
			}else{
				$("#txtDataListHospital").html("<option value='"+selectHospital+"'>"+ selectHospital+ "</option>");
				$("#txtDataListHospital").combobox();
				$(".custom-combobox-input").val(selectHospital);
			}
			
		});
		
		
		$("#chkDunnoCode").click(function(){
			var check = $(this).prop('checked');
			if(check){
				$("#searchGroupHospital").show();
				$("#txtHospitalCode").attr("disabled",true);
				$("#txtHospitalCode").val("");
				$("#txtHospitalCode").css("background-color","#e7e7e7");
			}else{
				$("#searchGroupHospital").hide();
				$("#txtHospitalCode").attr("disabled",false);
				$("#txtHospitalCode").css("background-color","");
			}
		});
		
		
		$("#btnSearch").click(
						function() {
						if('${USER}'===''){
							$.loadpage(null, true);
						}else{
							var check = $("#chkDunnoCode").prop('checked');
							var hospitalCode = "";
							if("${USER.userType eq 'Hospital'}" == "true"){
								hospitalCode = "${USER.officeCode}";
							}else{
								if(check == true){
									if($("#txtDataListHospital").val()!=hospitalFirst){
										hospitalCode = $("#txtDataListHospital").val();
									}else{
										hospitalCode = "";
									}
								}else{
									hospitalCode = $("#txtHospitalCode").val();
								}
							}
							$.ajax({
										url : '${pageContext.request.contextPath}/summarypid/searchByPID',
										data : {
											searchBy : $("#searchBy").val(),
											value : $.trim($("#txtSearch").val()),
											hospitalCode : $.trim(hospitalCode),
											dateFromAdmidTime : formatStrDate($("#txtFromDateAdmidTime").val()),
											dateToAdmidTime : formatStrDate($("#txtToDateAdmidTime").val())
										},
										type : "POST",
										async : true,
										success : function(data) {
											window.location.href = '${pageContext.request.contextPath}/summarypid?c=y';
										}
									});
									}
						});
	});

	var hospitalFirst = "กรุณาเลือกหน่วยบริการ";
	$.getHospital = function(zoneId, provinceId, async) {
		//$("#txtDataListHospital").val("");
		$.ajax({
					url : '${pageContext.request.contextPath}/master/getHospital',
					type : "POST",
					data:{zoneId : zoneId, provinceId : provinceId},
					async : async,
					success : function(data) {
						if (data.success) {
							if (data.code === "0000") {
								datas = data.datas;
								var option = "<option value='" + hospitalFirst + "' selected>"
										+ hospitalFirst + "</option>";
								var selected = "";
								//var hospitals = new Array();
								$.each(
												data.datas,
												function(key, value) {

													var len = value.hospitalCode.length;
													var hospitalCode = value.hospitalCode
															.substring(len - 5,
																	len);
													option += "<option value='" + hospitalCode + " - " + value.hospitalName + "'>"
															+ hospitalCode
															+ " - "
															+ value.hospitalName
															+ "</option>";

												});
								$("#txtDataListHospital").html("");
								$("#txtDataListHospital").html(option);
								$("#txtDataListHospital").combobox();
							}
						} else {
							$.alert("ERROR" + data.code, data.msg);
						}
					}
				});
		
				
	};
	
	//Set New function of table
	$(function(){
		var rowspan_thead1 = "3453px";
		var rowspan_thead2 = "6050px";
		$("#hide_table").hide();
		$("#tbValueData").css("height","410px");
		$(".hidden-table").hide();
		$("#thead2").hide();
		
		$("#tbHeaderData").attr("width",rowspan_thead1);
		$("#tbBodyData").attr("width",rowspan_thead1);
		
		$("#show_table").click(function(){

			$("#tbHeaderData").attr("width",rowspan_thead2);
			$("#tbBodyData").attr("width",rowspan_thead2);
			
			$("#tbValueData").css("height","390px");
			
			$("#thead1").hide();
			$("#thead2").show();
			
			$(".hidden-table").show();
			
			$("#show_table").hide();
			$("#hide_table").show();
		});
		
		$("#hide_table").click(function(){

			$("#tbHeaderData").attr("width",rowspan_thead1);
			$("#tbBodyData").attr("width",rowspan_thead1);
			
			$("#tbValueData").css("height","410px");
			
			$("#thead1").show();
			$("#thead2").hide();
			
			$(".hidden-table").hide();
			
			$("#show_table").show();
			$("#hide_table").hide();
		});
		
	});
</script>

<style>
.amount {
	color: blue;
	text-align: right;
}
.hidden-table{
/* 	display:none */
}

</style>
</head>

<body>
	<!------------------- Header ------------------>
	<div class="panel">
		<jsp:include page="../include/header.jsp" />
	</div>
	<!--------------------------------------------->

	<div class="block-content">
		<!--<jsp:include page="../include/breadcrumb.jsp" />-->

		<div id="content" class="content-data">
			<div class="panel">
				<div class="panel-content text-center">
					<div style="margin-top: 5px;">
						ค้นหาจาก <select id="searchBy" style="width: 100px;height: 28px;font-size: 14px;">
							<option value="pid" selected="selected">PID</option>
							<option value="hn">HN</option>
							<option value="an">AN</option>
						</select> &nbsp;<input type="text" id="txtSearch">&nbsp;
						<c:choose>
							<c:when test='${USER.userType eq "Hospital"}'>
								หน่วยบริการ&nbsp;<input type="text" value="${USER.officeCode} - ${USER.officeName}" style="font-size: 14px;width:230px" disabled/><p>
							</c:when>
							<c:otherwise>
								รหัสหน่วยบริการ&nbsp;<input type="text" id="txtHospitalCode" maxlength="5"/>&nbsp;
								<input type="checkbox" id="chkDunnoCode"/>&nbsp;<font color="red">กรณีเลือกจากชื่อหน่วยบริการ</font><p>
								<div id="searchGroupHospital" style="display:none">
									เขต&nbsp;&nbsp;<select id="txtDataListZone" style="height: 28px;font-size: 14px;"></select>&nbsp;
									จังหวัด&nbsp;<select id="txtDataListProvince" style="height: 28px;font-size: 14px;"></select>&nbsp;
									หน่วยบริการ&nbsp;<select id="txtDataListHospital" style="height: 28px;"></select><p>
								</div>
							</c:otherwise>
						</c:choose>
							วันที่เข้ารับการรักษา&nbsp;<input type="text" id="txtFromDateAdmidTime" />
							&nbsp;ถึง&nbsp;<input type="text" id="txtToDateAdmidTime" /><p>
							<button id="btnSearch">ค้นหา</button>
					</div>
					<div id="detailData">
						<div>
							PID&nbsp;<b>${SESSION_SUMMARY_PID.pid}</b>&nbsp;&nbsp;
							ชื่อ-นามสกุล&nbsp;<b>${SESSION_SUMMARY_PID.fullName}</b>
						</div>
						<div>
							จำนวนรายการทั้งหมด&nbsp;<b>${fn:length(SESSION_SUMMARY_PID.lstSummaryDetailsDatas)}</b>&nbsp;ราย&nbsp;
							ผ่าน&nbsp;<font style="font-weight: bold; text-decoration: underline;"
								id="personPass">${SESSION_SUMMARY_PID.personPass}</font>&nbsp;รายการ&nbsp;
							อุทธรณ์&nbsp;<font style="font-weight: bold; text-decoration: underline;"
								id="personAppeal">${SESSION_SUMMARY_PID.personAppeal}</font>&nbsp;รายการ&nbsp;
							ไม่ผ่าน&nbsp;<font style="font-weight: bold; text-decoration: underline;"
								id="personNotPass">${SESSION_SUMMARY_PID.personNotPass}</font>&nbsp;รายการ&nbsp;
							ไม่เข้าเกณฑ์&nbsp;<font style="font-weight: bold; text-decoration: underline;"
								id="standardNotPass">${SESSION_SUMMARY_PID.standardNotPass}</font>&nbsp;รายการ
						</div>
						<div style="float: left; margin: 1px;">
							<img alt="Export to Excel"
								src="${pageContext.request.contextPath}/images/file_xls.gif"
								class="pointer-cursor" title="Export to Excel" id="exportExcel"
								onclick="fnExcelReport('tbAll', '${SESSION_SUMMARY_PID.pid}');">
							<span style="color: red; font-size: 14px; margin-left: 10px">
								*หมายเหตุ ORF=เบิกจ่ายจากต้นสังกัด</span>
						</div>
						<div style="float: right; margin: 1px;">
							<button id="show_table"><img width="12px" src="${pageContext.request.contextPath}/images/arrow_right.png" /> แสดงข้อมูลอุทธรณ์</button>
							<button id="hide_table"><img width="12px" src="${pageContext.request.contextPath}/images/arrow_left.png" /> ซ่อนข้อมูลอุทธรณ์</button>
						</div>
					</div>
					
					<div class="data-table" style="padding-right: 10px;">
						<table width="5380px" cellspacing="0" cellpadding="0"
							id="tbHeaderData" style="padding-right: 17px;">
							<thead id="thead1">
								<tr>
									<td rowspan="3" width="40px">ลำดับ</td>
									<td rowspan="3" width="100px">Tran Id</td>
									<td rowspan="3" width="100px">EClaim No</td>
									<td rowspan="3" width="70px">HN</td>
									<td rowspan="3" width="70px">AN</td>
									<td rowspan="3" width="70px">Rep No</td>
									<td rowspan="3" width="50px">OP/IP</td>
									<td rowspan="3" width="180px">โรงพยาบาล</td>
									<td rowspan="3" width="110px">วันที่เข้ารับการรักษา</td>
									<td rowspan="3" width="110px">วันที่จำหน่าย</td>
									<td rowspan="2" colspan="2">เงินเดือน</td>
									<td rowspan="3" width="100px">เรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="3" width="60px">สถานะ</td>
									<td rowspan="3" width="100px">ค่า พรบ.&nbsp;(บาท)</td>
									<td rowspan="3" width="100px">ชดเชย&nbsp;(บาท)</td>
									<td rowspan="3" width="100px">ส่วนต่างจากการเรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="3" width="70px">Batch Id</td>
									<td rowspan="3" width="120px">วันที่จ่าย</td>
									<td rowspan="3" width="100px">สถานะการเบิกจ่าย</td> 
									<td rowspan="3" width="70px">สิทธิ์การเบิก</td> 
									<td rowspan="2" colspan="2">OP&nbsp;REFER(NON&nbsp;HC)</td>
									<td colspan="9" rowspan="1">กองทุน&nbsp;(บาท)</td>
								</tr>
								<tr>
									<td>HC</td>
									<td>AE</td>
									<td>INST</td>
									<td>IP</td>
									<td>DMIS</td>
									<td>OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
								</tr>
								<tr>
									<td width="70px">ร้อยละ(%)</td>
									<td width="100px">จำนวนเงิน(บาท)</td>
									<td width="100px">HMAIN</td>
									<td width="100px">NHSO</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
								</tr>
							</thead>
							<thead id="thead2" style="display:none">
								<tr>
									<td rowspan="4" width="40px">ลำดับ</td>
									<td rowspan="4" width="100px">Tran Id</td>
									<td rowspan="4" width="100px">EClaim No</td>
									<td rowspan="4" width="70px">HN</td>
									<td rowspan="4" width="70px">AN</td>
									<td rowspan="4" width="70px">Rep No</td>
									<td rowspan="4" width="50px">OP/IP</td>
									<td rowspan="4" width="180px">โรงพยาบาล</td>
									<td rowspan="4" width="110px">วันที่เข้ารับการรักษา</td>
									<td rowspan="4" width="110px">วันที่จำหน่าย</td>
									<td rowspan="3" colspan="2">เงินเดือน</td>
									<td rowspan="4" width="100px">เรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="4" width="60px">สถานะ</td>
									<td rowspan="4" width="100px">ค่า พรบ.&nbsp;(บาท)</td>
									<td rowspan="4" width="100px">ชดเชย&nbsp;(บาท)</td>
									<td rowspan="4" width="100px">ส่วนต่างจากการเรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="4" width="70px">Batch Id</td>
									<td rowspan="4" width="120px">วันที่จ่าย</td>
									<td rowspan="4" width="100px">สถานะการเบิกจ่าย</td> 
									<td rowspan="4" width="70px">สิทธิ์การเบิก</td> 
									<td rowspan="3" colspan="2">OP&nbsp;REFER(NON&nbsp;HC)</td>
									<td colspan="9" rowspan="2">กองทุน&nbsp;(บาท)</td>
									<td colspan="24">ข้อมูลอุทธรณ์</td>
								</tr>
								<tr >
									<td colspan="11" width="300px">ข้อมูลเดิม</td>
									<td colspan="11" width="300px">ข้อมูลใหม่</td>
									<td colspan="2" width="200px">ชดเชยสุทธิ</td>
								</tr>
								<tr>
									<td>HC</td>
									<td>AE</td>
									<td>INST</td>
									<td>IP</td>
									<td>DMIS</td>
									<td>OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
									<!-- Appeal -->
									<td rowspan="2" width="100px" >เรียกเก็บ(บาท)</td>
									<td >HC</td>
									<td >AE</td>
									<td >INST</td>
									<td >IP</td>
									<td >DMIS</td>
									<td >OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
									<td rowspan="2" width="100px" >จ่ายชดเชย</td>
									<td rowspan="2" width="100px" >เรียกเก็บ(บาท)</td>
									<td >HC</td>
									<td >AE</td>
									<td >INST</td>
									<td >IP</td>
									<td >DMIS</td>
									<td >OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
									<td rowspan="2" width="100px" >จ่ายชดเชย</td>
									<td width="100px" rowspan="2" >จ่ายเพิ่ม</td>
									<td width="100px" rowspan="2" >เรียกคืน</td>
								</tr>
								<tr>
									<td width="70px">ร้อยละ(%)</td>
									<td width="100px">จำนวนเงิน(บาท)</td>
									<td width="100px">HMAIN</td>
									<td width="100px">NHSO</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<!-- Appeal -->
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>

									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
								</tr>
							</thead>
						</table>

						<div style="overflow-y: auto; overflow-x: hidden; position: absolute; height: 390px;" id="tbValueData">
							<table width="5380px" cellspacing="0" cellpadding="0" id="tbBodyData" style="padding-right: 17px;">
								<tbody>
									<c:choose>
										<c:when test="${empty SESSION_SUMMARY_PID.lstSummaryDetailsDatas}">
											<tr>
												<td colspan="24" class="required">ไม่มีข้อมูล</td>
											</tr>
										</c:when>
										<c:otherwise>
										<script>
											$(function(){
												$("#detailData").css("display","block");
											});
										</script>
											<c:forEach items="${SESSION_SUMMARY_PID.lstSummaryDetailsDatas}"
												varStatus="i" var="x">
												<c:set var="status" value="ผ่าน" />
												<c:set var="clazz" value="" />
												<c:set var="clazzTD" value="" />

												<c:choose>
													<c:when test="${x.status eq 'A'}">
														<c:set var="status" value="อุทธรณ์" />
														<c:set var="clazz"
															value="pointer-cursor ${x.parentTranId} ${x.discharge} ${x.compensation} ${x.fund}" />
													</c:when>
													<c:when test="${empty x.codeId}">
														<c:set var="status" value="ผ่าน" />
														<c:if test="${x.orf eq 'Y'}">
															<c:set var="status" value="ผ่าน<br>(ORF)*" />
														</c:if>
														<c:set var="clazzTD" value="" />
													</c:when>
													<c:when test="${x.codeId eq 'DENY'}">
														<c:set var="statusDeny" value="" />
														<c:if test="${x.hc ne 'N' and x.hc ne 'C' }">
															<c:set var="statusDeny" value="${x.hc}" />
														</c:if>
														<c:if test="${x.ae ne 'N' and x.ae ne 'C' }">
															<c:if test="${statusDeny ne '' }">
																<c:set var="statusDeny" value="${statusDeny }," />
															</c:if>
															<c:set var="statusDeny" value="${statusDeny } ${x.ae}" />
														</c:if>
														<c:if test="${x.inst ne 'N' and x.inst ne 'C' }">
															<c:if test="${statusDeny ne '' }">
																<c:set var="statusDeny" value="${statusDeny }," />
															</c:if>
															<c:set var="statusDeny" value="${statusDeny } ${x.inst}" />
														</c:if>
														<c:if test="${x.ip ne 'N' and x.ip ne 'C' }">
															<c:if test="${statusDeny ne '' }">
																<c:set var="statusDeny" value="${statusDeny }," />
															</c:if>
															<c:set var="statusDeny" value="${statusDeny } ${x.ip}" />
														</c:if>
														<c:if test="${x.dmis ne 'N' and x.dmis ne 'C' }">
															<c:if test="${statusDeny ne '' }">
																<c:set var="statusDeny" value="${statusDeny }," />
															</c:if>
															<c:set var="statusDeny" value="${statusDeny } ${x.dmis}" />
														</c:if>
														<c:set var="status"
															value="ไม่เข้าเกณฑ์<br>(${statusDeny})" />
														<c:set var="clazzTD" value="required" />
													</c:when>
													<c:otherwise>
														<c:set var="status" value="ไม่ผ่าน<br>("/>
														<c:set var="tmps" value="${fn:split(x.codeId, ',') }"/>
														<c:forEach items="${tmps }" var="s" varStatus="c">
															<c:choose>
																<c:when test="${c.count == 1 }">
																	<c:set var="status" value="${status}C${s }"/>
																</c:when>
																<c:otherwise>
																	<c:set var="status" value="${status},<br>C${s }"/>
																</c:otherwise>
															</c:choose>
														</c:forEach>
														<c:set var="status" value="${status})"/>
														
														<c:set var="clazzTD" value="required"/>
													</c:otherwise>
												</c:choose>
												<c:set var="totalDisCom" value="${x.discharge - x.compensation}"/>
												<c:set var="clazzDisCom" value=""/>
												<c:if test="${totalDisCom < 0}">
													<c:set var="clazzDisCom" value="required"/>
												</c:if>
												<tr class="${clazz}" id="${x.pid }" title="${x.pid } ${ x.fullname}">
													<td width="40px">${i.count}</td>
													<td width="100px">${x.tranId }&nbsp;</td>
													<td width="100px">${x.eclaimNo }&nbsp;</td>
													<td width="70px">${x.hn }&nbsp;</td>
													<td width="70px">${x.an }&nbsp;</td>
													<td width="70px">${x.repNo }</td>
													<td width="50px">${x.personType }</td>
													<td width="180px" align="left">&nbsp;&nbsp;${x.hospitalName}</td>
													<td width="110px">${x.admidDate }&nbsp;${x.admidTime }</td>
													<td width="110px">${x.dischargeDate}&nbsp;${x.dischargeTime }</td>
													<td width="70px">${x.salaryPercent }</td>
													<td width="100px" align="right"><fmt:formatNumber value="${x.salaryAmount}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right"><fmt:formatNumber value="${x.discharge}" pattern="#,##0.00" />&nbsp;</td>
													<td width="60px" class="${clazzTD}">${status}</td>
													<td width="100px" align="right"><fmt:formatNumber value="${x.chargeRule}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right">
														<!--<c:choose>
															<c:when test="${x.expression eq 'H' }">
																<fmt:formatNumber value="${x.compensation }" pattern="#,##0.00" />
															</c:when>
															<c:when test="${x.expression eq 'S' }">
																<span style="color: red">ยอดหักหนี้</span>
															</c:when>
														</c:choose>-->
													
														<fmt:formatNumber value="${x.compensation}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right" class="${clazzDisCom}">
														<fmt:formatNumber value="${totalDisCom}" pattern="#,##0.00" />&nbsp;
													</td>
													<td width="70px">${x.batchId}</td>
													<td width="120px">${x.strPaymentDate}</td>
													<td width="100px">
														<c:choose> 
															<c:when test="${x.statusType eq 'C'}">ตรวจสอบชดเชย</c:when>
															<c:when test="${x.statusType eq 'E'}">อนุมัติจ่ายชดเชย</c:when>
															<c:when test="${x.statusType eq 'B'}">ตัดงบประมาณ</c:when>
															<c:when test="${x.statusType eq 'P'}">ตั้งหนี้</c:when>
															<c:when test="${x.statusType eq 'T'}">ตัดจ่าย</c:when>
														</c:choose>
													</td> 
													<td width="70px">${x.authType}</td>
													<td width="100px" align="right">
														<fmt:formatNumber value="${x.orfHMain}" pattern="#,##0.00" />&nbsp;
													</td>
													<td width="100px" align="right">
														<fmt:formatNumber value="${x.orfNHSO}" pattern="#,##0.00" />&nbsp;
													</td>
													
													<c:choose>
														<c:when test="${x.hc eq 'C'}">
															<c:choose>
															<c:when test="${x.sumsHC ne 0}">
															<td width="100px" class="amount" 
																title="<fmt:formatNumber value="${x.sumsHC}" pattern="#,##0.00"/>"><fmt:formatNumber
																	value="${x.sumsHC}" pattern="#,##0.00" />&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td width="100px">&nbsp;</td>
															</c:otherwise>
															</c:choose>
														</c:when>
														<c:when test="${x.hc eq 'N'}">
															<td width="100px">&nbsp;</td>
														</c:when>
														<c:otherwise>
															<td width="100px">${x.hc}&nbsp;</td>
														</c:otherwise>
													</c:choose>
													<c:choose>
														<c:when test="${x.ae eq 'C'}">
															<c:choose>
															<c:when test="${x.sumsAE ne 0}">
															<td width="100px" class="amount"
																title="<fmt:formatNumber value="${x.sumsAE}" pattern="#,##0.00"/>"><fmt:formatNumber
																	value="${x.sumsAE}" pattern="#,##0.00" />&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td width="100px">&nbsp;</td>
															</c:otherwise>
															</c:choose>
														</c:when>
														<c:when test="${x.ae eq 'N'}">
															<td width="100px">&nbsp;</td>
														</c:when>
														<c:otherwise>
															<td width="100px">${x.ae}&nbsp;</td>
														</c:otherwise>
													</c:choose>
													<c:choose>
														<c:when test="${x.inst eq 'C'}">
															<c:choose>
															<c:when test="${x.sumsINST ne 0}">
															<td width="100px" class="amount"
																title="<fmt:formatNumber value="${x.sumsINST}" pattern="#,##0.00"/>"><fmt:formatNumber
																	value="${x.sumsINST}" pattern="#,##0.00" />&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td width="100px">&nbsp;</td>
															</c:otherwise>
															</c:choose>
														</c:when>
														<c:when test="${x.inst eq 'N'}">
															<td width="100px">&nbsp;</td>
														</c:when>
														<c:otherwise>
															<td width="100px">${x.inst}&nbsp;</td>
														</c:otherwise>
													</c:choose>
													<c:choose>
														<c:when test="${x.ip eq 'C'}">
															<c:choose>
															<c:when test="${x.sumsIP ne 0}">
															<td width="100px" class="amount"
																title="<fmt:formatNumber value="${x.sumsIP}" pattern="#,##0.00"/>"><fmt:formatNumber
																	value="${x.sumsIP}" pattern="#,##0.00" />&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td width="100px">&nbsp;</td>
															</c:otherwise>
															</c:choose>
														</c:when>
														<c:when test="${x.ip eq 'N'}">
															<td width="100px">&nbsp;</td>
														</c:when>
														<c:otherwise>
															<td width="100px">${x.ip}&nbsp;</td>
														</c:otherwise>
													</c:choose>
													<c:choose>
														<c:when test="${x.dmis eq 'C'}">
															<c:choose>
															<c:when test="${x.sumsDMIS ne 0}">
															<!--<td width="98px" class="amount" title="<fmt:formatNumber value="${x.discharge}" pattern="#,##0.00"/>"><fmt:formatNumber value="${x.discharge}" pattern="#,##0.00"/>&nbsp;</td>-->
															<td width="100px" class="amount"
																title="<fmt:formatNumber value="${x.sumsDMIS}" pattern="#,##0.00"/>"><fmt:formatNumber
																	value="${x.sumsDMIS}" pattern="#,##0.00" />&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td width="100px">&nbsp;</td>
															</c:otherwise>
															</c:choose>
														</c:when>
														<c:when test="${x.dmis eq 'N'}">
															<td width="100px">&nbsp;</td>
														</c:when>
														<c:otherwise>
															<td width="100px">${x.dmis}</td>
														</c:otherwise>
													</c:choose>
													<c:choose>
														<c:when test="${x.op eq 'C'}">
															<c:choose>
															<c:when test="${x.sumsOP ne 0}">
															<td width="100px" class="amount"
																title="<fmt:formatNumber value="${x.sumsOP}" pattern="#,##0.00"/>"><fmt:formatNumber
																	value="${x.sumsOP}" pattern="#,##0.00" />&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td width="100px">&nbsp;</td>
															</c:otherwise>
															</c:choose>
														</c:when>
														<c:when test="${x.op eq 'N'}">
															<td width="100px">&nbsp;</td>
														</c:when>
														<c:otherwise>
															<td width="100px">${x.op}</td>
														</c:otherwise>
													</c:choose>
													<c:choose>
														<c:when test="${x.pa eq 'C'}">
															<c:choose>
															<c:when test="${x.sumsPA ne 0}">
															<td width="100px" class="amount"
																title="<fmt:formatNumber value="${x.sumsPA}" pattern="#,##0.00"/>"><fmt:formatNumber
																	value="${x.sumsPA}" pattern="#,##0.00" />&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td width="100px">&nbsp;</td>
															</c:otherwise>
															</c:choose>
														</c:when>
														<c:when test="${x.pa eq 'N'}">
															<td width="100px">&nbsp;</td>
														</c:when>
														<c:otherwise>
															<td width="100px">${x.pa}</td>
														</c:otherwise>
													</c:choose>
													<c:choose>
														<c:when test="${x.sumsDRUG ne '0'}">
															<c:choose>
															<c:when test="${x.sumsDRUG ne 0}">
															<!-- DRUG -->
															<td width="100px" class="amount"
																title="<fmt:formatNumber value="${x.sumsDRUG}" pattern="#,##0.00"/>">
																<fmt:formatNumber value="${x.sumsDRUG}" pattern="#,##0.00" />&nbsp;
															</td>
															</c:when>
															<c:otherwise>
																<td width="100px">&nbsp;</td>
															</c:otherwise>
															</c:choose>
														</c:when>
														<c:otherwise>
															<td width="100px">&nbsp;</td>
														</c:otherwise>
													</c:choose>
													<c:choose>
														<c:when test="${x.ot eq 'C'}">
															<c:choose>
															<c:when test="${x.sumsOT ne 0}">
															<td width="100px" class="amount"
																title="<fmt:formatNumber value="${x.sumsOT}" pattern="#,##0.00"/>"><fmt:formatNumber
																	value="${x.sumsOT}" pattern="#,##0.00" />&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td width="100px">&nbsp;</td>
															</c:otherwise>
															</c:choose>
														</c:when>
														<c:when test="${x.ot eq 'N'}">
															<td width="100px">&nbsp;</td>
														</c:when>
														<c:otherwise>
															<td width="100px">${x.ot}</td>
														</c:otherwise>
													</c:choose>
													
													<c:choose>
														<c:when test="${x.status ne 'A' }">
															<td style="color: blue" class="hidden-table" style="width:1020px" colspan="11"> ไม่มีอุทธรณ์</td> 
															<td style="color: blue" class="hidden-table" style="width:1020px" colspan="11"> ไม่มีอุทธรณ์</td> 
															<td style="color: blue" class="hidden-table" style="width:100px" colspan="1"></td> 
															<td style="color: blue" class="hidden-table" style="width:100px" colspan="1"></td> 
<!-- 															<td style="border: 1px solid #000000;" style="color: blue" width="815px" colspan="8">ไม่มีอุทธรณ์</td> -->
<!-- 															<td style="border: 1px solid #000000;" style="color: blue" width="815px" colspan="8">ไม่มีอุทธรณ์</td> -->
														</c:when>
														<c:otherwise>
															<td width="100px" style="text-align:right" class="hidden-table"><fmt:formatNumber
																	value="${x.oldTotal}" pattern="#,##0.00" />&nbsp;</td>
															<c:choose>
																<c:when test="${x.oldHC eq 'C'}">
																	<c:choose>
																	<c:when test="${x.oldSumsHC ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.oldSumsHC}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.oldSumsHC}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.oldHC eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.oldHC}&nbsp;</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.oldAE eq 'C'}">
																	<c:choose>
																	<c:when test="${x.oldSumsAE ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.oldSumsAE}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.oldSumsAE}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.oldAE eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.oldAE}&nbsp;</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.oldINST eq 'C'}">
																	<c:choose>
																	<c:when test="${x.oldSumsINST ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.oldSumsINST}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.oldSumsINST}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.oldINST eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.oldINST}&nbsp;</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.oldIP eq 'C'}"> 
																	<c:choose>
																	<c:when test="${x.oldSumsIP ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.oldSumsIP}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.oldSumsIP}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.oldIP eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.oldIP}&nbsp;</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.oldDMIS eq 'C'}">
																	<c:choose>
																	<c:when test="${x.oldSumsDMIS ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.oldSumsDMIS}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.oldSumsDMIS}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.oldDMIS eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.oldDMIS}</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.oldOP eq 'C'}">
																	<c:choose>
																	<c:when test="${x.oldSumsOP ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.oldSumsOP}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.oldSumsOP}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.oldOP eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.oldOP}</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.oldPA eq 'C'}">
																	<c:choose>
																	<c:when test="${x.oldSumsPA ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.oldSumsPA}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.oldSumsPA}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.oldPA eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.oldPA}</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.oldSumsDRUG ne '0'}">
																	<c:choose>
																	<c:when test="${x.oldSumsDRUG ne 0}">
																	<!-- DRUG -->
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.oldSumsDRUG}" pattern="#,##0.00"/>">
																		<fmt:formatNumber value="${x.oldSumsDRUG}" pattern="#,##0.00" />&nbsp;
																	</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.oldOT eq 'C'}">
																	<c:choose>
																	<c:when test="${x.oldSumsOT ne 0}">
																	<td width="100px" class="amount hidden-table" 
																		title="<fmt:formatNumber value="${x.oldSumsOT}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.oldSumsOT}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.oldOT eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.oldOT}</td>
																</c:otherwise>
															</c:choose>
																	
															<td width="100px" style="text-align:right" class="hidden-table"><fmt:formatNumber
																	value="${x.oldAmount}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" style="text-align:right" class="hidden-table"><fmt:formatNumber
																	value="${x.discharge}" pattern="#,##0.00" />&nbsp;</td>
															<c:choose>
																<c:when test="${x.hc eq 'C'}">
																	<c:choose>
																	<c:when test="${x.sumsHC ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.sumsHC}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.sumsHC}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.hc eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.hc}&nbsp;</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.ae eq 'C'}">
																	<c:choose>
																	<c:when test="${x.sumsAE ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.sumsAE}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.sumsAE}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.ae eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.ae}&nbsp;</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.inst eq 'C'}">
																	<c:choose>
																	<c:when test="${x.sumsINST ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.sumsINST}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.sumsINST}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.inst eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.inst}&nbsp;</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.ip eq 'C'}">
																	<c:choose>
																	<c:when test="${x.sumsIP ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.sumsIP}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.sumsIP}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.ip eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.ip}&nbsp;</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.dmis eq 'C'}">
																	<c:choose>
																	<c:when test="${x.sumsDMIS ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.sumsDMIS}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.sumsDMIS}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.dmis eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.dmis}</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.op eq 'C'}">
																	<c:choose>
																	<c:when test="${x.sumsOP ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.sumsOP}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.sumsOP}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.op eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.op}</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.pa eq 'C'}">
																	<c:choose>
																	<c:when test="${x.sumsPA ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.sumsPA}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.sumsPA}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.pa eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.pa}</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.sumsDRUG ne '0'}">
																	<c:choose>
																	<c:when test="${x.sumsDRUG ne 0}">
																	<!-- DRUG -->
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.sumsDRUG}" pattern="#,##0.00"/>">
																		<fmt:formatNumber value="${x.sumsDRUG}" pattern="#,##0.00" />&nbsp;
																	</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:otherwise>
															</c:choose>
															<c:choose>
																<c:when test="${x.ot eq 'C'}">
																	<c:choose>
																	<c:when test="${x.sumsOT ne 0}">
																	<td width="100px" class="amount hidden-table"
																		title="<fmt:formatNumber value="${x.sumsOT}" pattern="#,##0.00"/>"><fmt:formatNumber
																			value="${x.sumsOT}" pattern="#,##0.00" />&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td width="100px" class="amount hidden-table">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																</c:when>
																<c:when test="${x.ot eq 'N'}">
																	<td width="100px" class="hidden-table">&nbsp;</td>
																</c:when>
																<c:otherwise>
																	<td width="100px" class="hidden-table">${x.ot}</td>
																</c:otherwise>
															</c:choose>
															
															<td width="100px" style="text-align:right" class="hidden-table"><fmt:formatNumber
																	value="${x.compensation}" pattern="#,##0.00" />&nbsp;</td>
															<c:set var="amnt"
																value="${x.oldAmount - x.compensation }" />
															<c:set var="pay" value="${0}" />
															<c:set var="return" value="${0}" />

															<c:choose>
																<c:when test="${amnt < 0 }">
																	<c:set var="pay"
																		value="${x.compensation - x.oldAmount}" />
																</c:when>
																<c:otherwise>
																	<c:set var="return" value="${amnt}" />
																</c:otherwise>
															</c:choose>

															<td width="100px" style="text-align:right" class="hidden-table"><fmt:formatNumber value="${pay}"
																	pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" style="text-align:right" class="hidden-table"><fmt:formatNumber
																	value="${return}" pattern="#,##0.00" />&nbsp;</td>
														</c:otherwise>
													</c:choose>
												</tr>
											</c:forEach>
											
												<c:set var="totalSalaryAmount" scope="session" value="0"/>
												<c:set var="totalDischarge" scope="session" value="0"/>
												<c:set var="totalChargeRule" scope="session" value="0"/>
												<c:set var="totalCompensation" scope="session" value="0"/>
												<c:set var="totalOrfHMain" scope="session" value="0"/>
												<c:set var="totalOrfNHSO" scope="session" value="0"/>
												
												<c:set var="totalSumHC" scope="session" value="0"/>
												<c:set var="totalSumAE" scope="session" value="0"/>
												<c:set var="totalSumINST" scope="session" value="0"/>
												<c:set var="totalSumIP" scope="session" value="0"/>
												<c:set var="totalSumDMIS" scope="session" value="0"/>
												<c:set var="totalSumOP" scope="session" value="0"/>
												<c:set var="totalSumPA" scope="session" value="0"/>
												<c:set var="totalSumOT" scope="session" value="0"/>
												
												<c:set var="totalOldTotal" scope="session" value="0"/>
												<c:set var="totalOldSumHC" scope="session" value="0"/>
												<c:set var="totalOldSumAE" scope="session" value="0"/>
												<c:set var="totalOldSumINST" scope="session" value="0"/>
												<c:set var="totalOldSumIP" scope="session" value="0"/>
												<c:set var="totalOldSumDMIS" scope="session" value="0"/>
												<c:set var="totalOldSumOP" scope="session" value="0"/>
												<c:set var="totalOldSumPA" scope="session" value="0"/>
												<c:set var="totalOldSumOT" scope="session" value="0"/>
												<c:set var="totalOldAmount" scope="session" value="0"/>
												
												
												<c:set var="totalNewSumHC" scope="session" value="0"/>
												<c:set var="totalNewSumAE" scope="session" value="0"/>
												<c:set var="totalNewSumINST" scope="session" value="0"/>
												<c:set var="totalNewSumIP" scope="session" value="0"/>
												<c:set var="totalNewSumDMIS" scope="session" value="0"/>
												<c:set var="totalNewSumOP" scope="session" value="0"/>
												<c:set var="totalNewSumPA" scope="session" value="0"/>
												<c:set var="totalNewSumOT" scope="session" value="0"/>
												<c:set var="totalNewDischarge"  scope="session" value="0"/>
												<c:set var="totalNewCompensation"  scope="session" value="0"/>	
												
												<c:set var="totalPay" scope="session" value="0"/>
												<c:set var="totalReturn" scope="session" value="0"/>
												
												<c:set var="countStatusA" scope="session" value="0"/>
										
											 
												<c:forEach items="${SESSION_SUMMARY_PID.lstSummaryDetailsDatas}"varStatus="i" var="x">
													<c:set var="sumsDRUG" value="${x.sumsDRUG}"/>
													<c:set var="oldSumsDRUG" value="${x.oldSumsDRUG}"/>
														
														<c:set var="totalSalaryAmount" value="${totalSalaryAmount + x.salaryAmount}"/>
														<c:set var="totalDischarge" value="${totalDischarge + x.discharge}"/>
														<c:set var="totalChargeRule"  value="${totalChargeRule + x.chargeRule}"/>
														<c:set var="totalCompensation" value="${totalCompensation + x.compensation}"/>	
														<c:set var="totalOrfHMain" value="${totalOrfHMain + x.orfHMain}"/>	
														<c:set var="totalOrfNHSO" value="${totalOrfNHSO + x.orfNHSO}"/>	
														
														<c:set var="totalSumHC" value="${totalSumHC + x.sumsHC}"/>
														<c:set var="totalSumAE" value="${totalSumAE + x.sumsAE}"/>
														<c:set var="totalSumINST" value="${totalSumINST + x.sumsINST}"/>
														<c:set var="totalSumIP" value="${totalSumIP + x.sumsIP}"/>
														<c:set var="totalSumDMIS" value="${totalSumDMIS + x.sumsDMIS}"/>
														<c:set var="totalSumOP" value="${totalSumOP + x.sumsOP}"/>
														<c:set var="totalSumPA" value="${totalSumPA + x.sumsPA}"/>
														<c:set var="totalSumOT" value="${totalSumOT + x.sumsOT}"/>
														<c:set var="totalSumDRUG" value="${totalSumDRUG + x.sumsDRUG}"/>
														
														<c:set var="totalOldTotal" value="${totalOldTotal + x.oldTotal}"/>
														<c:set var="totalOldSumHC" value="${totalOldSumHC + x.oldSumsHC}"/>
														<c:set var="totalOldSumAE" value="${totalOldSumAE + x.oldSumsAE}"/>
														<c:set var="totalOldSumINST" value="${totalOldSumINST + x.oldSumsINST}"/>
														<c:set var="totalOldSumIP" value="${totalOldSumIP + x.oldSumsIP}"/>
														<c:set var="totalOldSumDMIS"  value="${totalOldSumDMIS + x.oldSumsDMIS}"/>
														<c:set var="totalOldSumOP" value="${totalOldSumOP + x.oldSumsOP}"/>
														<c:set var="totalOldSumPA" value="${totalOldSumPA + x.oldSumsPA}"/>
														<c:set var="totalOldSumOT" value="${totalOldSumOT + x.oldSumsOT}"/>
														<c:set var="totalOldSumDRUG" value="${totalOldSumDRUG + x.oldSumsDRUG}"/>
														<c:set var="totalOldAmount" value="${totalOldAmount + x.oldAmount}"/>
														
														<c:if test="${x.status eq 'A' }">
															
															<c:set var="countStatusA" scope="session" value="${countStatusA + 1}"/>
														
															<c:set var="totalNewDischarge" value="${totalNewDischarge + x.discharge}"/>
															<c:set var="totalNewCompensation" value="${totalNewCompensation + x.compensation}"/>	
															<c:set var="totalNewSumHC" value="${totalNewSumHC + x.sumsHC}"/>
															<c:set var="totalNewSumAE" value="${totalNewSumAE + x.sumsAE}"/>
															<c:set var="totalNewSumINST" value="${totalNewSumINST + x.sumsINST}"/>
															<c:set var="totalNewSumIP" value="${totalNewSumIP + x.sumsIP}"/>
															<c:set var="totalNewSumDMIS" value="${totalNewSumDMIS + x.sumsDMIS}"/>
															<c:set var="totalNewSumOP" value="${totalNewSumOP + x.sumsOP}"/>
															<c:set var="totalNewSumPA" value="${totalNewSumPA + x.sumsPA}"/>
															<c:set var="totalNewSumOT" value="${totalNewSumOT + x.sumsOT}"/>
															<c:set var="totalNewSumDRUG" value="${totalNewSumDRUG + x.sumsDRUG}"/>
														
													
															<c:set var="amnt" value="${x.oldAmount - x.compensation }" />
															<c:set var="pay" value="${0}" />
															<c:set var="return" value="${0}" />
	
															<c:choose>
																<c:when test="${amnt < 0 }">
																	<c:set var="pay" value="${x.compensation - x.oldAmount}" />
																</c:when>
																<c:otherwise>
																	<c:set var="return" value="${amnt}" />
																</c:otherwise>
															</c:choose>
															
															<c:set var="totalPay" value="${totalPay + pay}"/>
															<c:set var="totalReturn" value="${totalReturn + return}"/>
														</c:if>
												</c:forEach>
												
												<c:set var="totalDisComTotal" value="${totalDischarge - totalCompensation}"/>
												<c:set var="clazzDisComTotal" value=""/>
												<c:if test="${totalDisComTotal < 0}">
													<c:set var="clazzDisComTotal" value="required"/>
												</c:if>
												<tr style="background-color: rgb(224,224,224);">
												
													<td colspan="10" style="text-align: center"><strong>รวม</strong>&nbsp;</td>
													<td width="70px"></td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalSalaryAmount}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalDischarge}" pattern="#,##0.00" />&nbsp;</td>
													<td width="60px"></td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalChargeRule}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalCompensation}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right" class="${clazzDisComTotal}">
														<fmt:formatNumber value="${totalDisComTotal}" pattern="#,##0.00" />&nbsp;
													</td>
													<td width="70px"></td>
													<td width="120px"></td>
													<td width="100px"></td>
													<td width="70px"></td>
													<td width="100px" align="right">
														<fmt:formatNumber value="${totalOrfHMain}" pattern="#,##0.00" />&nbsp;
													</td>
													<td width="100px" align="right">
														<fmt:formatNumber value="${totalOrfNHSO}" pattern="#,##0.00" />&nbsp;
													</td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalSumHC}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalSumAE}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalSumINST}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalSumIP}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalSumDMIS}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalSumOP}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalSumPA}" pattern="#,##0.00" />&nbsp;</td>
													<td width="100px" align="right">
														<!-- DRUG -->
														<fmt:formatNumber value="${totalSumDRUG}" pattern="#,##0.00" />&nbsp;
													</td>
													<td width="100px" align="right"><fmt:formatNumber value="${totalSumOT}" pattern="#,##0.00" />&nbsp;</td>	
														
																
													<c:choose>
														<c:when test="${countStatusA > 0}">
															
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalOldTotal}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalOldSumHC}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalOldSumAE}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalOldSumINST}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalOldSumIP}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalOldSumDMIS}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalOldSumOP}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalOldSumPA}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">
																<!-- DRUG -->
																<fmt:formatNumber value="${totalOldSumDRUG}" pattern="#,##0.00" />&nbsp;
															</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalOldSumOT}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalOldAmount}" pattern="#,##0.00" />&nbsp;</td>
															
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalNewDischarge}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalNewSumHC}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalNewSumAE}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalNewSumINST}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalNewSumIP}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalNewSumDMIS}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalNewSumOP}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalNewSumPA}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">
																<!-- DRUG -->
																<fmt:formatNumber value="${totalNewSumDRUG}" pattern="#,##0.00" />&nbsp;
															</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalNewSumOT}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalNewCompensation}" pattern="#,##0.00" />&nbsp;</td>
															
															<c:set var="tt" value="${totalPay - totalReturn}"/>
															<c:choose>
																<c:when test="${tt < 0}">
																	<c:set var="totalReturn" value="${totalReturn - totalPay}"/>
																	<c:set var="totalPay" value="0"/>
																</c:when>
																<c:otherwise>
																	<c:set var="totalReturn" value="0"/>
																	<c:set var="totalPay" value="${tt}"/>
																</c:otherwise>
															</c:choose>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalPay}" pattern="#,##0.00" />&nbsp;</td>
															<td width="100px" class="hidden-table" align="right"><fmt:formatNumber value="${totalReturn}" pattern="#,##0.00" />&nbsp;</td>
														</c:when>
														<c:otherwise> 
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															
															
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
															<td width="100px" class="hidden-table" align="right">&nbsp;</td>
														</c:otherwise>
													</c:choose>
												</tr>
										</c:otherwise>
									</c:choose>
								</tbody>
							</table>
						</div>
					</div>
					<table id="tbAll" style="display: none;">
						<tr>
							<td>
								<table width="4480px" cellspacing="0" cellpadding="0">
									<thead>
										<tr align="center"
											style="background: #a3d9ff; font-weight: bold; font-size: 14px; height: 20px;">
											<td rowspan="4" width="40px"
												style="border: 1px solid #000000; border-bottom: 0px;" >ลำดับ</td>
											<td rowspan="4" width="100px" style="border: 1px solid #000000; border-bottom: 0px;">Tran Id</td>
											<td rowspan="4" width="100px" style="border: 1px solid #000000; border-bottom: 0px;">EClaim No</td>
											<td rowspan="4" width="100px" style="border: 1px solid #000000; border-bottom: 0px;">HN</td>
											<td rowspan="4" width="100px"
												style="border: 1px solid #000000; border-bottom: 0px;">AN</td>
											<td rowspan="4" width="120px"
												style="border: 1px solid #000000; border-bottom: 0px;">Rep No.</td>
											<td rowspan="4" width="120px" style="border: 1px solid #000000; border-bottom: 0px;">OP/IP</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="250px">โรงพยาบาล</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="120px">วันที่เข้ารับการรักษา</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="120px">วันที่จำหน่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="3" colspan="2">เงินเดือน</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="150px">เรียกเก็บ&nbsp;(บาท)</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="60px">สถานะ</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="150px">ค่า พรบ.&nbsp;(บาท)</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="150px">ชดเชย&nbsp;(บาท)</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="150px">ส่วนต่างจากการเรียกเก็บ&nbsp;(บาท)</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="150px">Batch Id</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="150px">วันที่จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="150px">สถานะการเบิกจ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="4" width="150px">สิทธิ์การเบิก</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="3" colspan="2" width="150px">OP&nbsp;REFER(NON&nbsp;HC)</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												colspan="9" rowspan="2">กองทุน&nbsp;(บาท)</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												colspan="24">ข้อมูลอุทธรณ์</td>
										</tr>
										<tr align="center"
											style="background: #a3d9ff; font-weight: bold; font-size: 14px; height: 20px;">
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												colspan="11" width="300px">ข้อมูลเดิม</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												colspan="11" width="300px">ข้อมูลใหม่</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												colspan="2" width="200px">ชดเชยสุทธิ</td>
										</tr>
										<tr align="center"
											style="background: #a3d9ff; font-weight: bold; font-size: 14px; height: 20px;">
											<td style="border: 1px solid #000000; border-bottom: 0px;">HC</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">AE</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">INST</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">IP</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">DMIS</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">OP</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">Prior Authorize</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">DRUG</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">ON TOP</td>
											<!-- Appeal -->
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="2" width="100px">เรียกเก็บ(บาท)</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">HC</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">AE</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">INST</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">IP</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">DMIS</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">OP</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">Prior Authorize</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">DRUG</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">ON TOP</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="2" width="100px">จ่ายชดเชย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="2" width="100px">เรียกเก็บ(บาท)</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">HC</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">AE</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">INST</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">IP</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">DMIS</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">OP</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">Prior Authorize</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">DRUG</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;">ON TOP</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												rowspan="2" width="100px">จ่ายชดเชย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px" rowspan="2">จ่ายเพิ่ม</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px" rowspan="2">เรียกคืน</td>
										</tr>
										<tr align="center"
											style="background: #a3d9ff; font-weight: bold; font-size: 14px; height: 20px;">
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="70px">ร้อยละ(%)</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="150px">จำนวนเงิน(บาท)</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">HMAIN</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">NHSO</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
											<!-- Appeal -->
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
				
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;"
												width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
											<td style="border: 1px solid #000000; border-bottom: 0px;" width="100px">สปสช.จ่าย</td>
										</tr>
									</thead>
									<tbody>
										<c:choose>
											<c:when test="${empty SESSION_SUMMARY_PID.lstSummaryDetailsDatas}">
												<tr>
													<td style="border: 1px solid #000000; border-right: 0px"
														colspan="24" class="required">ไม่มีข้อมูล</td>
												</tr>
											</c:when>
											<c:otherwise>
												<c:forEach items="${SESSION_SUMMARY_PID.lstSummaryDetailsDatas}"
													varStatus="i" var="x">
													<c:set var="status" value="ผ่าน" />
													<c:set var="clazz" value="" />
													<c:set var="clazzTD" value="" />
				
													<c:choose>
														<c:when test="${x.status eq 'A'}">
															<c:set var="status" value="อุทธรณ์" />
															<c:set var="clazz"
																value="pointer-cursor ${x.parentTranId} ${x.discharge} ${x.compensation} ${x.fund}" />
														</c:when>
														<c:when test="${empty x.codeId}">
															<c:set var="status" value="ผ่าน" />
															<c:if test="${x.orf eq 'Y'}">
																<c:set var="status" value="ผ่าน<br>(ORF)*" />
															</c:if>
															<c:set var="clazzTD" value="" />
														</c:when>
														<c:when test="${x.codeId eq 'DENY'}">
															<c:set var="statusDeny" value="" />
															<c:if test="${x.hc ne 'N' and x.hc ne 'C' }">
																<c:set var="statusDeny" value="${x.hc}" />
															</c:if>
															<c:if test="${x.ae ne 'N' and x.ae ne 'C' }">
																<c:if test="${statusDeny ne '' }">
																	<c:set var="statusDeny" value="${statusDeny }," />
																</c:if>
																<c:set var="statusDeny" value="${statusDeny } ${x.ae}" />
															</c:if>
															<c:if test="${x.inst ne 'N' and x.inst ne 'C' }">
																<c:if test="${statusDeny ne '' }">
																	<c:set var="statusDeny" value="${statusDeny }," />
																</c:if>
																<c:set var="statusDeny" value="${statusDeny } ${x.inst}" />
															</c:if>
															<c:if test="${x.ip ne 'N' and x.ip ne 'C' }">
																<c:if test="${statusDeny ne '' }">
																	<c:set var="statusDeny" value="${statusDeny }," />
																</c:if>
																<c:set var="statusDeny" value="${statusDeny } ${x.ip}" />
															</c:if>
															<c:if test="${x.dmis ne 'N' and x.dmis ne 'C' }">
																<c:if test="${statusDeny ne '' }">
																	<c:set var="statusDeny" value="${statusDeny }," />
																</c:if>
																<c:set var="statusDeny" value="${statusDeny } ${x.dmis}" />
															</c:if>
															<c:set var="status" value="ไม่เข้าเกณฑ์<br>(${statusDeny})" />
															<c:set var="clazzTD" value="required" />
														</c:when>
														<c:otherwise>
															<c:set var="status" value="ไม่ผ่าน<br>(C${x.codeId})" />
															<c:set var="clazzTD" value="required" />
														</c:otherwise>
													</c:choose>
													<c:set var="totalDisCom" value="${x.discharge - x.compensation}"/>
													<c:set var="clazzDisCom" value=""/>
													<c:if test="${totalDisCom < 0}">
														<c:set var="clazzDisCom" value="required"/>
													</c:if>
													<tr class="${clazz}" id="${x.pid }"
														title="${x.pid } ${ x.fullname}">
														<td style="border: 1px solid #000000; border-right: 0px"
															width="40px">${i.count}</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="40px">${x.tranId}</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="40px">&nbsp;${x.eclaimNo}</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="100px">${x.hn }&nbsp;</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="100px">${x.an }&nbsp;</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="120px">${x.repNo }&nbsp;</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="120px" align="center">${x.personType }</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="250px" align="left">&nbsp;&nbsp;${x.hospitalName}</td>
														<td width="120px" style="border: 1px solid #000000; border-right: 0px" align="center">${x.admidDate }&nbsp;${x.admidTime }</td>
														<td width="120px" style="border: 1px solid #000000; border-right: 0px" align="center">${x.dischargeDate}&nbsp;${x.dischargeTime }</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="70px" align="center">${x.salaryPercent }</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="150px" align="right"><fmt:formatNumber
																value="${x.salaryAmount}" pattern="#,##0.00" /></td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="150px" align="right"><fmt:formatNumber
																value="${x.discharge}" pattern="#,##0.00" /></td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="60px" class="${clazzTD}" align="center">${status}</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="150px" align="right"><fmt:formatNumber
																value="${x.chargeRule}" pattern="#,##0.00" /></td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="150px" align="right">
														<!--<c:choose>
															<c:when test="${x.expression eq 'H' }">
																<fmt:formatNumber value="${x.compensation }" pattern="#,##0.00" />
															</c:when>
															<c:when test="${x.expression eq 'S' }">
																<span style="color: red">ยอดหักหนี้</span>
															</c:when>
														</c:choose>-->
													
													<fmt:formatNumber value="${x.compensation}" pattern="#,##0.00" /></td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="150px" align="right" class="${clazzDisCom}"><fmt:formatNumber
																value="${totalDisCom}" pattern="#,##0.00" /></td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="150px" align="center">${x.batchId}</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="150px" align="center">${x.strPaymentDate}</td>
														<td style="border: 1px solid #000000; border-right: 0px" width="70px" align="center">
															<c:choose> 
																<c:when test="${x.statusType eq 'C'}">ตรวจสอบชดเชย</c:when>
																<c:when test="${x.statusType eq 'E'}">ตั้งฎีกา</c:when>
																<c:when test="${x.statusType eq 'B'}">ตัดงบประมาณ</c:when>
																<c:when test="${x.statusType eq 'P'}">ตั้งหนี้</c:when>
																<c:when test="${x.statusType eq 'T'}">ตัดจ่าย</c:when>
															</c:choose>
														</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="150px" align="center">${x.authType}</td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="150px" align="right"><fmt:formatNumber
																value="${x.orfHMain}" pattern="#,##0.00" /></td>
														<td style="border: 1px solid #000000; border-right: 0px"
															width="150px" align="right"><fmt:formatNumber
																value="${x.orfNHSO}" pattern="#,##0.00" /></td>
														<c:choose>
															<c:when test="${x.hc eq 'C'}">
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px"><fmt:formatNumber
																		value="${x.sumsHC}" pattern="#,##0.00" /></td>
															</c:when>
															<c:when test="${x.hc eq 'N'}">
																<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px">${x.hc}</td>
															</c:otherwise>
														</c:choose>
														<c:choose>
															<c:when test="${x.ae eq 'C'}">
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px"><fmt:formatNumber
																		value="${x.sumsAE}" pattern="#,##0.00" /></td>
															</c:when>
															<c:when test="${x.ae eq 'N'}">
																<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px">${x.ae}</td>
															</c:otherwise>
														</c:choose>
														<c:choose>
															<c:when test="${x.inst eq 'C'}">
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px"><fmt:formatNumber
																		value="${x.sumsINST}" pattern="#,##0.00" /></td>
															</c:when>
															<c:when test="${x.inst eq 'N'}">
																<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td width="100px" style="border: 1px solid #000000; border-right: 0px">${x.inst}</td>
															</c:otherwise>
														</c:choose>
														<c:choose>
															<c:when test="${x.ip eq 'C'}">
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px"><fmt:formatNumber
																		value="${x.sumsIP}" pattern="#,##0.00" /></td>
															</c:when>
															<c:when test="${x.ip eq 'N'}">
																<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td width="100px" style="border: 1px solid #000000; border-right: 0px">${x.ip}</td>
															</c:otherwise>
														</c:choose>
														<c:choose>
															<c:when test="${x.dmis eq 'C'}">
																<!--<td style="border: 1px solid #000000;border-right:0px" width="98px" class="amount" title="<fmt:formatNumber value="${x.discharge}" pattern="#,##0.00"/>"><fmt:formatNumber value="${x.discharge}" pattern="#,##0.00"/></td>-->
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px"><fmt:formatNumber
																		value="${x.sumsDMIS}" pattern="#,##0.00" /></td>
															</c:when>
															<c:when test="${x.dmis eq 'N'}">
																<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td width="100px" style="border: 1px solid #000000; border-right: 0px">${x.dmis}</td>
															</c:otherwise>
														</c:choose>
														<c:choose>
															<c:when test="${x.op eq 'C'}">
																<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																		value="${x.sumsOP}" pattern="#,##0.00" /></td>
															</c:when>
															<c:when test="${x.op eq 'N'}">
																<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td style="border: 1px solid #000000; border-right: 0px" width="100px">${x.op}</td>
															</c:otherwise>
														</c:choose>
														<c:choose>
															<c:when test="${x.pa eq 'C'}">
																<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																		value="${x.sumsPA}" pattern="#,##0.00" /></td>
															</c:when>
															<c:when test="${x.pa eq 'N'}">
																<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td style="border: 1px solid #000000; border-right: 0px" width="100px">${x.pa}</td>
															</c:otherwise>
														</c:choose>
														<c:choose>
															<c:when test="${x.sumsDRUG ne '0'}">
																<!-- DRUG -->
																<td style="border: 1px solid #000000; border-right: 0px" width="100px">
																	<fmt:formatNumber value="${x.sumsDRUG}" pattern="#,##0.00" />
																</td>
															</c:when>
															<c:otherwise>
																<td style="border: 1px solid #000000; border-right: 0px" width="100px">&nbsp;</td>
															</c:otherwise>
														</c:choose>
														<c:choose>
															<c:when test="${x.ot eq 'C'}">
																<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																		value="${x.sumsOT}" pattern="#,##0.00" /></td>
															</c:when>
															<c:when test="${x.ot eq 'N'}">
																<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
															</c:when>
															<c:otherwise>
																<td style="border: 1px solid #000000; border-right: 0px" width="100px">${x.ot}</td>
															</c:otherwise>
														</c:choose>
														
														<c:choose>
															<c:when test="${x.status ne 'A'}">
																<td style="border: 1px solid #000000" style="color: blue"  colspan="11"></td>
																<td style="border: 1px solid #000000;border-left: 0px" style="color: blue"  colspan="11"></td>
																<td style="border: 1px solid #000000;border-left: 0px" style="color: blue"></td>
																<td style="border: 1px solid #000000;border-left: 0px" style="color: blue"></td>
															</c:when>
															<c:otherwise>
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px"><fmt:formatNumber value="${x.oldTotal}"
																		pattern="#,##0.00" />
																</td>
																<c:choose>
																	<c:when test="${x.oldHC eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.oldSumsHC}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.oldHC eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px"
																			width="100px">${x.oldHC}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.oldAE eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.oldSumsAE}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.oldAE eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px"
																			width="100px">${x.oldAE}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.oldINST eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.oldSumsINST}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.oldINST eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px"
																			width="100px">${x.oldINST}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.oldIP eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.oldSumsIP}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.oldIP eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px"
																			width="100px">${x.oldIP}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.oldDMIS eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.oldSumsDMIS}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.oldDMIS eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px"
																			width="100px">${x.oldDMIS}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.oldOP eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.oldSumsOP}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.oldOP eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px">${x.oldOP}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.oldPA eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.oldSumsPA}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.oldPA eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px">${x.oldPA}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.oldSumsDRUG ne '0'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.oldSumsDRUG}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px">&nbsp;</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.oldOT eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.oldSumsOT}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.oldOT eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px">${x.oldOT}</td>
																	</c:otherwise>
																</c:choose>
																		
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px"><fmt:formatNumber value="${x.oldAmount}"
																		pattern="#,##0.00" /></td>
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px"><fmt:formatNumber value="${x.discharge}"
																		pattern="#,##0.00" /></td>
																<c:choose>
																	<c:when test="${x.hc eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.sumsHC}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.hc eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px"
																			width="100px">${x.hc}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.ae eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.sumsAE}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.ae eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px"
																			width="100px">${x.ae}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.inst eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.sumsINST}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.inst eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px"
																			width="100px">${x.inst}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.ip eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.sumsIP}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.ip eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px"
																			width="100px">${x.ip}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.dmis eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.sumsDMIS}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.dmis eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px"
																			width="100px">${x.dmis}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.op eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.sumsOP}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.op eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px">${x.op}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.pa eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.sumsPA}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.pa eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px">${x.pa}</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.sumsDRUG ne '0'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.sumsDRUG}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px">&nbsp;</td>
																	</c:otherwise>
																</c:choose>
																<c:choose>
																	<c:when test="${x.ot eq 'C'}">
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px"><fmt:formatNumber
																				value="${x.sumsOT}" pattern="#,##0.00" /></td>
																	</c:when>
																	<c:when test="${x.ot eq 'N'}">
																		<td width="100px" style="border: 1px solid #000000; border-right: 0px">&nbsp;</td>
																	</c:when>
																	<c:otherwise>
																		<td style="border: 1px solid #000000; border-right: 0px" width="100px">${x.ot}</td>
																	</c:otherwise>
																</c:choose>
																
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px"><fmt:formatNumber
																		value="${x.compensation}" pattern="#,##0.00" /></td>
																<c:set var="amnt" value="${x.oldAmount - x.compensation }" />
																<c:set var="pay" value="${0}" />
																<c:set var="return" value="${0}" />
				
																<c:choose>
																	<c:when test="${amnt < 0 }">
																		<c:set var="pay" value="${x.compensation - x.oldAmount}" />
																	</c:when>
																	<c:otherwise>
																		<c:set var="return" value="${amnt}" />
																	</c:otherwise>
																</c:choose>
				
																<td style="border: 1px solid #000000; border-right: 0px"
																	width="100px"><fmt:formatNumber value="${pay}"
																		pattern="#,##0.00" /></td>
																<td style="border: 1px solid #000000"
																	width="100px"><fmt:formatNumber value="${return}"
																		pattern="#,##0.00" /></td>
															</c:otherwise>
														</c:choose>
													</tr>
												</c:forEach>
												
												<tr style="background-color: rgb(224,224,224);">
																	<td colspan="10" align="center" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><strong>รวม</strong></td>
																	<td width="70px" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"></td>
																	<td width="150px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalSalaryAmount}" pattern="#,##0.00" /></td>
																	<td width="150px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalDischarge}" pattern="#,##0.00" /></td>
																	<td width="60px" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"></td>
																	<td width="150px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalChargeRule}" pattern="#,##0.00" /></td>
																	<td width="150px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalCompensation}" pattern="#,##0.00" /></td>
																	<td width="150px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;" class="${clazzDisComTotal}"><fmt:formatNumber value="${totalDisComTotal}" pattern="#,##0.00" /></td>
																	<td width="150px" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"></td>
																	<td width="150px" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"></td>
																	<td width="70px" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"></td>
																	<td width="70px" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"></td>
																	<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">
																		<fmt:formatNumber value="${totalOrfHMain}" pattern="#,##0.00" />&nbsp;
																	</td>
																	<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">
																		<fmt:formatNumber value="${totalOrfNHSO}" pattern="#,##0.00" />&nbsp;
																	</td>
																	
																	<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalSumHC}" pattern="#,##0.00" /></td>
																	<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalSumAE}" pattern="#,##0.00" /></td>
																	<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalSumINST}" pattern="#,##0.00" /></td>
																	<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalSumIP}" pattern="#,##0.00" /></td>
																	<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalSumDMIS}" pattern="#,##0.00" /></td>
																	<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalSumOP}" pattern="#,##0.00" /></td>
																	<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalSumPA}" pattern="#,##0.00" /></td>
																	<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalSumDRUG}" pattern="#,##0.00" /></td>		
																	<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalSumOT}" pattern="#,##0.00" /></td>		
																	
																	
																	<c:choose>
																	<c:when test="${countStatusA > 0}">
																	
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalOldTotal}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalOldSumHC}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalOldSumAE}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalOldSumINST}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalOldSumIP}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalOldSumDMIS}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalOldSumOP}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalOldSumPA}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalOldSumDRUG}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalOldSumOT}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalOldAmount}" pattern="#,##0.00" /></td>
																		
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalNewDischarge}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalNewSumHC}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalNewSumAE}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalNewSumINST}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalNewSumIP}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalNewSumDMIS}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalNewSumOP}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalNewSumPA}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalNewSumDRUG}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalNewSumOT}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalNewCompensation}" pattern="#,##0.00" /></td>
																		
																		<c:set var="tt" value="${totalPay - totalReturn}"/>
																		<c:choose>
																			<c:when test="${tt < 0}">
																				<c:set var="totalReturn" value="${totalReturn - totalPay}"/>
																				<c:set var="totalPay" value="0"/>
																			</c:when>
																			<c:otherwise>
																				<c:set var="totalReturn" value="0"/>
																				<c:set var="totalPay" value="${tt}"/>
																			</c:otherwise>
																		</c:choose>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;"><fmt:formatNumber value="${totalPay}" pattern="#,##0.00" /></td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-top:0px;"><fmt:formatNumber value="${totalReturn}" pattern="#,##0.00" /></td>
																	
																	</c:when>
																	<c:otherwise> 
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		
																		
																		<td width="100px" align="right" style="border: 1px solid #000000; border-right: 0px;border-top:0px;">&nbsp;</td>
																		<td width="100px" align="right" style="border: 1px solid #000000; border-top:0px;">&nbsp;</td>
																	</c:otherwise>
																	</c:choose>
																
																</tr>
												
												
											</c:otherwise>
										</c:choose>
									</tbody>
								</table>
			</td>
		</tr>
	</table>
				</div>
			</div>
		</div>
	</div>


</body>
</html>
